package com.tiger.log.test;

import com.tiger.log.common.annotation.business.form.ExcludeParams;
import com.tiger.log.common.annotation.business.form.FormCollect;
import com.tiger.log.common.annotation.business.form.PrimaryKey;
import com.tiger.log.common.annotation.business.json.JsonCollect;
import com.tiger.log.common.annotation.business.json.TargetJson;
import com.tiger.log.common.enums.Collect;
import com.tiger.log.common.response.Response;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName MeT1
 * @Description TODO
 * @Author huxuehao
 **/
@RestController
@RequestMapping("/test")
public class MeT1 {

    @GetMapping("/getTs")
    public Object getTs(@RequestParam("name") String name, @RequestParam("age") int age) {

        return "name=" + name +"; age=" + age;
    }

    @GetMapping("/postJsonTs")
    @JsonCollect(type = Collect.SUBMIT, classify = "myClassify", code = "0001", comment = "测试1")
    public Object postJsonTs(@TargetJson(primaryKey = "id") @RequestBody Person person) {
        return Response.success(person.toString());
    }

    @GetMapping("/postFormTs")
    @ExcludeParams(exclude = {"test"})
    @FormCollect(type = Collect.MODIFY, classify = "myClassify", code = "0002", comment = "测试2")
    public Object postFormTs(@PrimaryKey @RequestParam("id") String id, @RequestParam("name") String name, @RequestParam("age") int age, Integer test, String name1) {

        return Response.success("id="+id+"; name=" + name +"; age=" + age);
    }
}
